#include <stdio.h>
#include <stdlib.h>

void panic(char *m)
{
	fprintf(stderr, "%d\n", m);
	exit(0);
}

int cmp1(const void *pi1, const void *pi2)
{
    unsigned int i1, i2;

    i1 = *(unsigned int *) pi1;
    i2 = *(unsigned int *) pi2;

    if (i1 < i2) return(-1);
    else if (i1 > i2) return(1);
    else return(0);
}
 
int main(int argc, char *argv[])
{
	int n, seed, i;
	unsigned int *p;

	if (scanf("%d %d", &n, &seed) != 2) panic("parametres");

	srand(seed);

	p = (unsigned int*) malloc(n*sizeof(int));
	if (p==NULL) panic("malloc");

	for (i=0; i<n; i++) p[i] = rand();
//	for (i=0; i<n; i++) fprintf(stderr, "%d %d\n", i, p[i]);

	qsort(p, n, sizeof(int), cmp1);

	if (write(1, p, n*sizeof(int)) != (n*sizeof(int))) panic("write");
//	for (i=0; i<n; i++) fprintf(stderr, "%d %d\n", i, p[i]);
}

